from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.validators import RegexValidator


class User(AbstractUser):
    email = models.EmailField(blank=True, verbose_name='邮箱地址')
    mobile_regex = RegexValidator(
        regex=r'^1\d{10}$',
        message="Mobile number must be 11 digits and start with 1."
    )
    mobile = models.CharField(max_length=11, validators=[mobile_regex], verbose_name='手机号')
